Please note:
You need to enable this mode manually by uncommenting this line in eql-start-swank.lisp
in your Slime directory:
(setf eql:*slime-mode* :repl-hook)
Requires ECL threads.
This should work with any Slime version that plays together with ECL.
Tested with ECL 12.7.1 (Windows: ECL 12.12.1)
~/.emacs
file:
(add-to-list 'load-path "~/slime/") ; slime path (add-to-list 'load-path "~/slime/contrib/") ; slime/contrib path (require 'slime) (slime-require 'swank-listener-hooks) (slime-setup '(slime-fancy))
~/.swank.lisp
file (or copy file eql/slime/.swank.lisp
in your home directory):
(setf swank:*globally-redirect-io* t) ; print output in Emacs
eql/slime/eql-start-swank.lisp
in your slime/
directory
-slime
can be omitted if the file name contains "start-swank"), optionally passing a Lisp file:
eql <path-to-slime>/eql-start-swank.lisp [file.lisp]
Meta-X slime-connect
(please note: use slime-connect
) and hit Return
2 times (confirming the default values).
Please note: if :dont-close
is set to T
in eql-start-swank.lisp
, quitting/restarting Emacs will not affect a running EQL program, that is: if you quit/restart Emacs, you can connect to the same swank/EQL you left when quitting Emacs.
(load "file.lisp")
The point here is: if you directly try to Eval Region an expression containing an EQL function, your swank server will crash, because it will not be evaluated in the GUI thread (Qt GUI methods need to be called from the GUI thread).
So, only run EQL functions directly from the Slime REPL.
If you want to use Eval Region containing EQL functions, use the method described above.
You may use the macro qeval
if you want to ensure evaluation in the GUI thread (this is meant to be used together with Eval Region only).
It behaves like a progn
, so you can do something like this:
(qeval (defvar *label* (qnew "QLabel")) (defvar *edit* (qnew "QLineEdit")))
Wrapping forms in qeval
will have no effect if you run your code outside of Slime (so there's no need to remove qeval
in your final program).
But note: the advantage using Eval Region (without qeval
) is that Lisp error conditions (not driven by Qt events) will not stop/pause your EQL program (that is, Qt event processing will continue).
Instead, if there is an error in code you either enter in the Slime REPL, or run with Eval Region wrapped in qeval
, the program will always pause (Qt event processing will be stopped until you take some action).
Be careful after entering the Slime debugger. If you see this:
[ABORT] Return to SLIME's top level.
[RESTART-QT-EVENTS] Last resort only - prefer "Return to SLIME's top level"
Always choose the first one, otherwise you'll be stuck.
For help see the qapropos
and qgui
functions.